package com.kygeng.springframework.bean;

import com.kygeng.springframework.beans.BeansException;
import com.kygeng.springframework.beans.factory.BeanClassLoaderAware;
import com.kygeng.springframework.beans.factory.BeanFactory;
import com.kygeng.springframework.beans.factory.BeanFactoryAware;
import com.kygeng.springframework.beans.factory.BeanNameAware;
import com.kygeng.springframework.context.ApplicationContext;
import com.kygeng.springframework.context.ApplicationContextAware;

/**
 * @Title: HelloService
 * @Author: kygeng
 * @Package: com.kygeng.springframework.bean
 * @Date: 2024/8/3 9:38
 * @Description:
 */
public class HelloService implements BeanNameAware, BeanClassLoaderAware, ApplicationContextAware, BeanFactoryAware {

    private ApplicationContext applicationContext;
    private BeanFactory beanFactory;

    private String uId;
    private String company;
    private String location;



    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.beanFactory = beanFactory;
    }

    @Override
    public void setBeanName(String beanName) {
        System.out.println("setBeanName : " + beanName);
    }

    @Override
    public void setBeanClassLoader(ClassLoader classLoader) {
        System.out.println("setBeanClassLoader : " + classLoader);
    }


    public ApplicationContext getApplicationContext() {
        return applicationContext;
    }

    public BeanFactory getBeanFactory() {
        return beanFactory;
    }

    public String getuId() {
        return uId;
    }

    public String getCompany() {
        return company;
    }

    public String getLocation() {
        return location;
    }

    @Override
    public String toString() {
        return "HelloService{" +
                "applicationContext=" + applicationContext +
                ", beanFactory=" + beanFactory +
                ", uId='" + uId + '\'' +
                ", company='" + company + '\'' +
                ", location='" + location + '\'' +
                '}';
    }
}
